package fatworm.query;

import fatworm.storage.table.*;

public class SortPlan implements Plan {
	
	private Plan p;
	private String name;
	private boolean flag;
	
	public SortPlan(Plan p, String name, int order) {
		this.p = p;
		this.name = name;
		if (order == 0)
			this.flag = true;
		else
			this.flag = false;
	}
	
	public Scan open() {
		return new SortScan(p.open(), name, flag);
	}
	
	public int blocksAccessed() {
		return p.blocksAccessed();
	}
	
	public int recordsOutput() {
		return p.recordsOutput();
	}
	
	public int distinctValues(String name) {
		return p.distinctValues(name);
	}
	
	public Schema getSchema() {
		return p.getSchema();
	}
	
}